package 实现线程.Test03;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class ThreadTest3 {
    public static void main(String[] args) {
        MyCallable call = new MyCallable();
        FutureTask task = new FutureTask(call);
        Thread t = new Thread(task);
        t.setName("t");
        t.start();

        try {
            System.out.println("线程执行结果：" + task.get());
            System.out.println("已拿到返回值");
        } catch (InterruptedException e) {
            e.printStackTrace();
        } catch (ExecutionException e) {
            e.printStackTrace();
        }

    }
}
